<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet"
	type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>新增标签</title>
</head>
<body>
	<div class="pd-20">
		<form 
			class="form form-horizontal" id="form-t_goods_tags-add">
			<input type="hidden" id="gtag_id" name="gtag_id"
				value='${t_goods_tags.gtag_id}' />

			<div class="row cl">
				<label class="form-label col-2">标签名称：</label>
				<div class="formControls col-10">
					<input type="text" class="input-text"
						value="${t_goods_tags.gtag_title}" placeholder="" id=""
						name="gtag_title" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">标签icon：</label>
				<div class="formControls col-10">
					<div class="formControls col-5">
						<div class="col-sm-10" id="iconimgdiv">
							<img
								<%-- <c:if test="${t_goods_tags.gtag_img==''||empty t_goods_tags.gtag_img}">src="<%=basePath%>img/default_img.png"</c:if> --%>
								<c:if test="${t_goods_tags.gtag_img!=''&&!empty t_goods_tags.gtag_img}">src="<%=imagePath%>${t_goods_tags.gtag_img}"</c:if>
								alt="..." class="margin" id="iconImg" style="height: 100px;">
							<a id="iconbutton" class="btn btn-primary"><i
								class="glyphicon glyphicon-picture"></i> 上传图片</a>
						</div>
					</div>
					<input type="hidden" class="input-text"
						value="${t_goods_tags.gtag_img}" placeholder="" id="gtag_img"
						name="gtag_img" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">标签描述：</label>
				<div class="formControls col-10">
					<input type="text" class="input-text"
						value="${t_goods_tags.gtag_desc}" placeholder="" id=""
						name="gtag_desc" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">状态：</label>
				<div class="formControls col-10">
					<select name="is_use"><option
							<c:if test="${t_goods_tags.is_use==1}">selected="selected"</c:if>
							value="1">启用</option>
						<option
							<c:if test="${t_goods_tags.is_use==2}">selected="selected"</c:if>
							value="2">禁用</option></select>
				</div>
			</div>
			<%-- 	<div class="row cl">
				<label class="form-label col-2">：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${t_goods_tags.ext_1}"
						placeholder="" id="" name="ext_1" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${t_goods_tags.ext_2}"
						placeholder="" id="" name="ext_2" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${t_goods_tags.ext_3}"
						placeholder="" id="" name="ext_3" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${t_goods_tags.ext_4}"
						placeholder="" id="" name="ext_4" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${t_goods_tags.ext_5}"
						placeholder="" id="" name="ext_5" datatype="*" nullmsg="不能为空">
				</div>
			</div> --%>

			<div class="row cl">
				<div class="col-10 col-offset-2">
					<button onClick="t_goods_tags_save_submit();"
						class="btn btn-primary radius" type="button">
						<i class="Hui-iconfont">&#xe632;</i> 保存并提交
					</button>
					<button onClick="layer_close();" class="btn btn-default radius"
						type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>
			</div>
		</form>
	</div>
	<!-- <script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> -->
	<script type="text/javascript" src="<%=basePath%>js/jQuery-2.1.4.min.js"></script>
	<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script>
	<script type="text/javascript" src="<%=basePath%>plugins/plupload/plupload.full.min.js"></script>

	<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">
		//商品缩略图
		var iconuploader = new plupload.Uploader({
			runtimes : 'html5,flash,silverlight,html4',
			browse_button : 'iconbutton', // you can pass in id...
			container : document.getElementById('iconimgdiv'), // ... or DOM Element itself
			url : '<%=path%>/backstage/goodstags-smallpic-upload',
			flash_swf_url : 'plupload/Moxie.swf',
			multi_selection : false,
			filters : {
				max_file_size : '5mb',
				mime_types : [ {
				title : "Image files",
					extensions : "jpg,gif,png"
				}, ]
			},
			init : {
				//文件上传成功回调
				FileUploaded : function(up, file, res) {
					var info = eval('(' + res.response + ')');
					if (info.error == "0000") {
						$("#iconImg").attr("src","<%=imagePath%>"+info.datas);
						$("#gtag_img").val(info.datas);
					} else {
						layer.msg(info.information, {
							icon : 2
						});
					}
				},
				//添加文件回调
				FilesAdded : function(up, files) {
					$.each(up.files, function(i, file) {
						if (up.files.length <= 1) {
							return;
						}
						up.removeFile(file);
					});

					iconuploader.start();
				},
				//文件上传进度回调
				UploadProgress : function(up, file) {
					//$("#jindu").html(file.percent + "%");
					//alert(file.percent);
					//$("#proId").css("width",file.percent+"%");
				},
				//上传出错
				Error : function(up, err) {
					var msg = "";

					if (err.code == -601) {
						msg = "文件类型错误";
					} else if (err.code == -600) {
						msg = "文件过大";
					} else {
						/* alert(err.code); */
						msg = "文件异常";
					}
					layer.msg(msg, {
						icon : 2
					});
				}
			}
		});
		iconuploader.init();
		
		function t_goods_tags_save_submit() {
			$.ajax({
				type:"post",
				url:"<%=path%>/backstage/t_goods_tags-add",
				data:$("#form-t_goods_tags-add").serialize(),
				success:function(msg){
					var info = eval('('+msg+')');
					if(info.error=="0000"){
						var index = parent.layer.getFrameIndex(window.name);
						if (index) {//关闭弹出层
							parent.$('.btn-refresh').click();
							parent.layer.close(index);
							parent.location.reload();
						} else {//单独的页面
							location.href = "<%=path%>/backstage/t_goods_tags-list";
						}
					}else{
						layer.msg("操作失败", {
							icon : 2
						});
					}
				}
			})
		}
	</script>
</body>
</html>

